package com.wkq.move.module.tv.ui.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import cn.jzvd.JzvdStd
import com.wkq.base.frame.activity.MvpBindingActivity
import com.wkq.move.R
import com.wkq.move.databinding.ActivityUsTvShowBinding
import com.wkq.move.module.tv.frame.presenter.UsTvShowPresenter
import com.wkq.move.module.tv.frame.view.UsTvShowView


/**
 *
 * 作者:吴奎庆
 *
 * 时间:2020/5/18
 *
 * 用途:
 */


class UsTvShowActivity :
    MvpBindingActivity<UsTvShowView, UsTvShowPresenter, ActivityUsTvShowBinding>() {
    //详情页地址
    var tvPath: String = ""
    var isExpend = false

    companion object {
        fun newInstance(context: Context, url: String?) {
            var intnet = Intent(context, UsTvShowActivity().javaClass)
            intnet.putExtra("tvPath", url)
            context.startActivity(intnet)
        }
    }

    override fun getLayoutId(): Int {
        return R.layout.activity_us_tv_show
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        tvPath = intent.getStringExtra("tvPath")
        if (mvpView != null) mvpView.initView()
        if (getPresenter() != null) getPresenter().initData(tvPath)
    }

    override fun onBackPressed() {
        if (JzvdStd.backPress()) {
            return
        }
        super.onBackPressed()
    }

    override fun onPause() {
        super.onPause()
        JzvdStd.releaseAllVideos()
    }
}